package com.objecteffects.ilmp.tumblr.method;

import java.util.HashMap;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;

/**
 * @author Rusty Wright
 */
@JsonInclude(JsonInclude.Include.NON_NULL)
public class Meta {
    private final int status;
    private final String msg;

    private final Map<String, Object> additionalProperties = new HashMap<>();

    @JsonCreator
    public Meta(@JsonProperty("status")
    final int _status, @JsonProperty("msg")
    final String _msg) {
        this.status = _status;
        this.msg = StringUtils.defaultIfBlank(_msg, "");
    }

    @JsonProperty("status")
    public int getStatus() {
        return this.status;
    }

    @JsonProperty("msg")
    public String getMsg() {
        return this.msg;
    }

    @JsonAnyGetter
    public Map<String, Object> getAdditionalProperties() {
        return this.additionalProperties;
    }

    @JsonAnySetter
    public void setAdditionalProperty(final String name, final Object value) {
        this.additionalProperties.put(name, value);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(final Object other) {
        return EqualsBuilder.reflectionEquals(this, other);
    }
}
